package com.ruicar.afs.cloud.apply.archive.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruicar.afs.cloud.apply.archive.entity.ApplyMappingArchive;
import com.ruicar.afs.cloud.apply.archive.enums.ApplyMappingArchiveEnum;
import com.ruicar.afs.cloud.apply.archive.mapper.ApplyMappingArchiveMapper;
import com.ruicar.afs.cloud.apply.archive.service.ApplyMappingArchiveService;
import org.springframework.stereotype.Service;

/**
 * @ClassName ApplyMappingArchiveServiceImpl
 * @Description: 档案映射信息表
 * @Author zyr
 * @Date 2020/9/27
 * @Version V1.0
 **/
@Service
public class ApplyMappingArchiveServiceImpl extends ServiceImpl<ApplyMappingArchiveMapper, ApplyMappingArchive> implements ApplyMappingArchiveService {
    @Override
    public String queryMappingResult(ApplyMappingArchiveEnum keyType, String keyOneValue) {
        ApplyMappingArchive applyMappingArchive = this.getOne(Wrappers.<ApplyMappingArchive>query().lambda()
                .eq(ApplyMappingArchive::getKeyType,keyType)
                .eq(ApplyMappingArchive::getKeyOneValue,keyOneValue)
                ,false
        );
        return applyMappingArchive.getKeyResultValue();
    }

    @Override
    public String queryMappingResult(ApplyMappingArchiveEnum keyType, String keyOneValue, String keyTwoValue) {
        ApplyMappingArchive applyMappingArchive = this.getOne(Wrappers.<ApplyMappingArchive>query().lambda()
                .eq(ApplyMappingArchive::getKeyType,keyType)
                .eq(ApplyMappingArchive::getKeyOneValue,keyOneValue)
                .eq(ApplyMappingArchive::getKeyTwoValue,keyTwoValue)
                ,false
        );
        return applyMappingArchive.getKeyResultValue();
    }

    @Override
    public String queryMappingResult(ApplyMappingArchiveEnum keyType, String keyOneValue, String keyTwoValue, String keyThreeValue) {
        ApplyMappingArchive applyMappingArchive = this.getOne(Wrappers.<ApplyMappingArchive>query().lambda()
                .eq(ApplyMappingArchive::getKeyType,keyType)
                .eq(ApplyMappingArchive::getKeyOneValue,keyOneValue)
                .eq(ApplyMappingArchive::getKeyTwoValue,keyTwoValue)
                .eq(ApplyMappingArchive::getKeyThreeValue,keyThreeValue)
                ,false
        );
        return applyMappingArchive.getKeyResultValue();
    }

    @Override
    public String queryMappingResult(ApplyMappingArchiveEnum keyType, String keyOneValue, String keyTwoValue, String keyThreeValue, String keyFourValue) {
        ApplyMappingArchive applyMappingArchive = this.getOne(Wrappers.<ApplyMappingArchive>query().lambda()
                .eq(ApplyMappingArchive::getKeyType,keyType)
                .eq(ApplyMappingArchive::getKeyOneValue,keyOneValue)
                .eq(ApplyMappingArchive::getKeyTwoValue,keyTwoValue)
                .eq(ApplyMappingArchive::getKeyThreeValue,keyThreeValue)
                .eq(ApplyMappingArchive::getKeyFourValue,keyFourValue)
                ,false
        );
        return applyMappingArchive.getKeyResultValue();
    }
}
